﻿@model StackExchange.Opserver.Data.SQL.SQLInstance
@{
    Layout = null;
    var types = Model.MemoryClerkSummary;
    var data = types.SafeData(true);
}
    <div class="summary-dashboard">
        <h3><a href="/sql/instance?node=@Model.Name">@Model.Name</a><span class="note">:</span> Memory Breakdown
            
            <span class="top-right-info">Updated @types.ToPollSpan()</span>
        </h3>
        @if (data.Any())
        {
        <div>
            <table>
                <thead>
                    <tr>
                        <th>Memory Clerk Type</th>
                        <th>Description</th>
                        <th colspan="2">Memory Used</th>
                        <th colspan="2">% Used</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var t in data)
                    {
                        <tr>
                            <td class="note">@t.ClerkType</td>
                            <td>@t.Name</td>
                            <td>@t.UsedBytes.ToSize()</td>
                            <td class="note">@t.UsedBytes.Pluralize("byte")</td>
                            <td style="width: 100px;"><div class="space-used" style="width: 100px; height: 5px"><div class="used good" style="width:@t.UsedPercent%"></div></div></td>
                            <td class="@(t.UsedPercent >= 1 ? "bold" : "note")">@(t.UsedPercent.ToString("#0.###"))%</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
        }
        else
        {
            <div class="no-content">No memory clerk information available</div>
        }
    </div>